let get_dims img =
  ((Sdlvideo.surface_info img).Sdlvideo.w, (Sdlvideo.surface_info
                                              img).Sdlvideo.h)

let triangleDroit image param file =
  let get_width (w, h) = w in
  let get_height (w, h) = h in
  let width = ((get_width (get_dims image)) / param) + 1 in
  let height = ((get_height (get_dims image)) / param) in
  for h = 1 to height do
    for i = 1 to (width - 1) do
      output_string file ("f " ^ (string_of_int (i + (width*(h-1)))) ^ " " ^
			     (string_of_int (i + 1 + (width*(h-1)))) ^ " " ^
			     (string_of_int ((i+1 + (width * h)))) ^ "\n") ;
    done
  done

let triangleGauche image param file =
  let get_width (w, h) = w in
  let get_height (w, h) = h in
  let width = ((get_width (get_dims image)) / param) + 1 in
  let height = ((get_height (get_dims image)) / param) in
  for h = 1 to height do
    for i = 1 to (width - 1) do
    output_string file ("f " ^ (string_of_int (i + (width*(h-1)))) ^ " " ^
			   (string_of_int (i+(width*h))) ^ " " ^
			   (string_of_int ((i+(width*h)) + 1)) ^ "\n") ;
    done
  done
